<%--
  Created by IntelliJ IDEA.
  User: taohj
  Date: 2014/6/29
  Time: 18:04
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<c:set var="dashboardMenuTag" value="myorg" scope="request"></c:set>
<c:set var="menu" value="none" scope="request"></c:set>

<!Doctype html>
<html>
<head>
    <base href="<%=basePath%>">
    <title>政府数据开放平台</title>
    <jsp:include page="../../commons/include.jsp"/>

    <link href="/resources/css/lib.css" rel="stylesheet">


    <script>
        $(function () {
            $(".pagination li").on('click', function () {
                $('form input[name="page"]').val($(this).attr("page"));
                $("form").submit();
            });


            $(".table tbody tr").each(function (index) {

                var org = $(this).attr('org');

                $(this).find(":last-child>ul>li:first").on('click', function () {
                    location.href = '/front/my/org/modifyV?id=' + org;
                });



                $(this).find(":last-child>ul>li:last").on('click', function () {
                    if (confirm("确定要删除吗？")) {
                        var appid = $(this).attr('appid');
                        location.href = '/front/my/org/remove?id=' + org;
                    }
                });




                $(this).find(":last-child>ul>li:first").next().on('click',function(){
                    location.href = '/front/my/org/dataset/data/auditV?org=' + org;
                });

                $(this).find(":last-child>ul>li:first").next().next().on('click',function(){
                    location.href = '/front/my/org/member/list?org=' + org;
                });

                $(this).find(":last-child>ul>li:first").next().next().next().on('click',function(){
                    location.href = '/front/my/org/role/list?org=' + org;
                });
            });
        });
    </script>


</head>
<body>


<jsp:include page="../../commons/top.jsp"/>

<div class="main" style="min-height: 600px">
    <jsp:include page="../../commons/dashboardMenu.jsp"/>


    <div>
        <div class="left">
            <c:set var="leftMenu" value="org" scope="request"></c:set>
           <jsp:include page="commons/leftMenu.jsp"/>
        </div>
        <div class="right">



            <div style="width: 100%;padding: 20px 0px 20px 20px; float: left;">

                <div style="height: 40px; ">
                    <input type="button" class="btn btn-primary" onclick="location.href='/front/my/org/createV'"
                           value="新&nbsp;&nbsp;&nbsp;增">
                </div>

                <div>
                    <form action="/front/my/org/list">
                        <input type="hidden" name="page">

                        <div>
                            <input type="text" name="name" value="${requestScope.result.pageResult.t.name}"
                                   style="height: 30px;width: 300px"><input type="submit" value="搜索" style="height: 34px">
                        </div>
                        <div style="height: 50px;line-height: 30px;font-size: 14px;font-weight: bold;padding: 10px">
                            排序：<select name="order" style="width: 100px;font-size: 14px;">
                            <option value="asc">名称升序</option>
                            <option value="desc"
                                    <c:if test="${requestScope.result.pageResult.sortBy=='desc'}">selected="selected" </c:if> >
                                名称降序
                            </option>
                        </select>
                        </div>
                    </form>
                </div>
            </div>


            <div style="padding: 20px 20px">
                <span style="font-size: 16px;font-weight: bold;">共找到条${requestScope.result.pageResult.total}记录</span>
            </div>

            <div style="padding: 20px;">
                <div style="min-height: 460px">
                    <table class="table" width="100%">
                        <thead>
                        <tr>
                            <td style="width: 40px;">序号</td>
                            <td style="width: 200px;">名称</td>
                            <td style="width: 40px;">图片</td>
                            <td style="width: 100px;">机构分类</td>
                            <td style="width: 100px;">创建人</td>
                            <td style="width: 60px;">审批状态</td>
                            <td style="width: 140px;">操作</td>
                        </tr>
                        </thead>

                        <tbody>
                        <c:forEach items="${requestScope.result.pageResult.rows}" var="org" varStatus="status">
                            <tr org="${org.id}">
                                <td>${(requestScope.result.pageResult.page-1)*requestScope.result.pageResult.size+status.count}</td>
                                <td><a href="/front/my/org/dataset/list?org=${org.id}">${org.name}</a></td>
                                <td><img src="${org.headimage}" width="30" height="30"></td>
                                <td>${org.category.name}</td>
                                <td>${org.creater.username}</td>
                                <td>${org.auditStatus.name}</td>
                                <td style="text-align: left">
                                    <ul id="icons" class="ui-widget ui-helper-clearfix">
                                        <li class="ui-state-default ui-corner-all" title="更新"><span class="ui-icon ui-icon-pencil"></span></li>
                                        <li class="ui-state-default ui-corner-all" title="数据审批"><span class="ui-icon ui-icon-check"></span></li>
                                        <li class="ui-state-default ui-corner-all" title="成员管理"><span class="ui-icon ui-icon-person"></span></li>
                                        <li class="ui-state-default ui-corner-all" title="角色管理"><span class="ui-icon ui-icon-contact"></span></li>
                                        <li class="ui-state-default ui-corner-all" title="删除"><span class="ui-icon ui-icon-trash"></span></li>
                                    </ul>
                                   <%-- <a href="javascript:void(0);">更新</a>
                                    &nbsp;
                                    <a href="javascript:;">数据审批</a>
                                    &nbsp;
                                    <a href="javascript:;">成员管理</a>
                                    &nbsp;
                                    <a href="javascript:;">角色管理</a>
                                    &nbsp;&nbsp;
                                    <a href="javascript:void(0);">删除</a>--%>
                                </td>
                            </tr>

                        </c:forEach>
                        </tbody>
                    </table>

                </div>


            </div>


            <div>
                <ul class="pagination" style="margin: 20px 30px;">
                    <li page="${requestScope.result.pageResult.startPage-1}">
                        &laquo;
                    </li>

                    <c:forEach begin="${requestScope.result.pageResult.startPage}"
                               end="${requestScope.result.pageResult.endPage}" var="index">
                        <li page="${index}" <c:if
                                test="${index==requestScope.result.pageResult.page}"> class="active" </c:if>>${index}
                        </li>
                    </c:forEach>

                    <li page="${requestScope.result.pageResult.endPage+1}">
                        &raquo;
                    </li>
                </ul>
            </div>

        </div>

    </div>

</div>


<jsp:include page="../../commons/buttom.jsp"/>
</body>
</html>
